/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Model;

import org.htmlparser.visitors.NodeVisitor;
import org.htmlparser.Tag;
//import java.lang.Thread;

import Rules.*;

/**
 *
 * @author Sinem
 */
public class RuleVisitor extends NodeVisitor{

    public String webPage;
    //Default constructor
    public RuleVisitor(String file)
    {
        super();
        webPage = file;
    }

    @Override
    public void visitTag(Tag incomingTag)
    {
        BaseRule rule;
        //Rule Checks for attributes        
        {
            rule = new AttributeRule(incomingTag);
            rule.setWebPage(webPage);
            rule.setLineNumber(incomingTag.getStartingLineNumber());
            rule.check();
            
        }
       //Check rules for special tags
       rule = new TagRule(incomingTag);
       rule.setWebPage(webPage);
       rule.setLineNumber(incomingTag.getStartingLineNumber());
       rule.check();       

    }
}
